import 'package:hotpot/generated/json/base/json_convert_content.dart';
import 'package:hotpot/models/product.dart';

Product $ProductFromJson(Map<String, dynamic> json) {
	final Product product = Product();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		product.id = id;
	}
	final String? image1920 = jsonConvert.convert<String>(json['image_1920']);
	if (image1920 != null) {
		product.image1920 = image1920;
	}
	final List<String>? websiteRibbonId = jsonConvert.convertListNotNull<String>(json['website_ribbon_id']);
	if (websiteRibbonId != null) {
		product.websiteRibbonId = websiteRibbonId;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		product.name = name;
	}
	final String? descriptionSale = jsonConvert.convert<String>(json['description_sale']);
	if (descriptionSale != null) {
		product.descriptionSale = descriptionSale;
	}
	final List<String>? categId = jsonConvert.convertListNotNull<String>(json['categ_id']);
	if (categId != null) {
		product.categId = categId;
	}
	final double? listPrice = jsonConvert.convert<double>(json['list_price']);
	if (listPrice != null) {
		product.listPrice = listPrice;
	}
	final String? barcode = jsonConvert.convert<String>(json['barcode']);
	if (barcode != null) {
		product.barcode = barcode;
	}
	final String? defaultCode = jsonConvert.convert<String>(json['default_code']);
	if (defaultCode != null) {
		product.defaultCode = defaultCode;
	}
	final double? qtyAvailable = jsonConvert.convert<double>(json['qty_available']);
	if (qtyAvailable != null) {
		product.qtyAvailable = qtyAvailable;
	}
	final int? shopNum = jsonConvert.convert<int>(json['shopNum']);
	if (shopNum != null) {
		product.shopNum = shopNum;
	}
	return product;
}

Map<String, dynamic> $ProductToJson(Product entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['image_1920'] = entity.image1920;
	data['website_ribbon_id'] =  entity.websiteRibbonId;
	data['name'] = entity.name;
	data['description_sale'] = entity.descriptionSale;
	data['categ_id'] =  entity.categId;
	data['list_price'] = entity.listPrice;
	data['barcode'] = entity.barcode;
	data['default_code'] = entity.defaultCode;
	data['qty_available'] = entity.qtyAvailable;
	data['shopNum'] = entity.shopNum;
	return data;
}